package com.ljw.hmall.clients;

import com.ljw.hmall.config.MyFeignInterceptorConfig;
import com.ljw.hmall.dto.PageDTO;
import com.ljw.hmall.pojo.Item;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(value = "itemservice",configuration = MyFeignInterceptorConfig.class)
public interface ItemClient {

    @GetMapping("/item/list")
    public PageDTO<Item> selectByPage(@RequestParam Integer page, @RequestParam Integer size);


    @GetMapping("/item")
    public List<Item> selectAll();

    @GetMapping("/item/rid")
    public Item getById(@RequestParam Long itemId);

    @PutMapping("/item/stock/{itemId}/{num}")
    public void updateById(@PathVariable Long itemId, @PathVariable Integer num);

    @PutMapping("/item/stock/recover/{itemId}/{num}")
    public void updateAddStock( @PathVariable Long itemId,@PathVariable Integer num);
}
